home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Camelot
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf
/
XLisp-Stat
/
Book
/
stackgraph.lsp
< prev
Wrap
Text File
|
1990-10-11
|
3KB
|
89 lines
; book pp.262-279
(require "data/stackloss")
(setf w (send graph-proto :new 4))
(send w :variable-label '(0 1 2 3) (list "Air" "Temp." "Conc." "Loss"))
(send w :add-points (list air temp conc loss))
(send w :adjust-to-data)
(send w :add-lines (list air temp conc loss))
(send w :x-axis t)
(send w :y-axis t)
(send w :range 1 16 28)
(send w :y-axis t t 7)
(send w :current-variables 2 3)
(send w :range 3 0 50)
(send w :y-axis t t 6)
(send w :current-variables 0 1)
(send w :x-axis nil)
(send w :y-axis nil)
(send w :scale-type 'variable)
(send w :transformation
'#2a((0 0 -1 0)
(0 0 0 -1)
(1 0 0 0)
(0 1 0 0)))
(send w :transformation nil)
(let* ((c (cos (/ pi 20)))
(s (sin (/ pi 20)))
(m (+ (* c (identity-matrix 4))
(* s '#2a((0 0 -1 0)
(0 0 0 -1)
(1 0 0 0)
(0 1 0 0))))))
(dotimes (i 10) (send w :apply-transformation m)))
(send w :transformation nil)
(dotimes (i 10) (send w :rotate-2 0 2 (/ pi 20) :draw nil)
(send w :rotate-2 1 3 (/ pi 20)))
(send w :transformation nil)
(require "test/showcoord")
(require "test/identifypoint")
(require "test/pointmove")
; book pp.287-289
(let ((h (+ (send w :text-ascent) (send w :text-descent))))
(send w :margin 0 (round (* 1.5 h)) 0 0))
(setf interp-overlay (send graph-overlay-proto :new))
(let* ((ascent (send w :text-ascent))
; (descent (send w :text-descent))
(x ascent)
(y (round (* 1.5 ascent)))
(box ascent))
(send interp-overlay :add-slot 'location
(list x y box (round (+ x (* 1.5 box))))))
(defmeth interp-overlay :location () (slot-value 'location))
(defmeth interp-overlay :redraw ()
(let* ((loc (send self :location))
(x (first loc))
(y (second loc))
(box (third loc))
(string-x (fourth loc))
(graph (send self :graph)))
(send graph :frame-rect x (- y box) box box)
(send graph :draw-string "Interpolate" string-x y)))
(defmeth interp-overlay :do-click (x y m1 m2)
(let* ((loc (send self :location))
(box (third loc))
(left (first loc))
(top (- (second loc) box))
(right (+ left box))
(bottom (+ top box))
(graph (send self :graph)))
(when (and (< left x right) (< top y bottom))
(send graph :interpolate)
t)))
(defmeth w :interpolate ()
(send self :transformation nil)
(dotimes (i 10)
(send self :rotate-2 0 2 (/ pi 20) :draw nil)
(send self :rotate-2 1 3 (/ pi 20))))
(send w :add-overlay interp-overlay)